package cn.agiledata.bank.interest.service;

import java.io.Serializable;

import org.hibernate.CallbackException;
import org.hibernate.type.Type;

import cn.agiledata.bank.hibernateBean.AccountBalance;

/**
 * 计算积数
 * @author jessik
 */
public interface IMutativeInterestService extends IInterestService {

	/**
	 * 返回最后累计积数
	 * 
	 * @param accountBalance
	 *            子账户的剩余资金对象
	 * @return 累计积数
	 */
	public abstract long getAccumulation(AccountBalance accountBalance)
			throws Exception, RuntimeException; 
	/**
	 * 产生积数，保存入数据库
	 * 
	 * @param accountBalance
	 *            子账户的剩余资金对象
	 */
	public abstract void setAccumulation(AccountBalance accountBalance)
			throws Exception, RuntimeException; 

	/**
	 * 产生积数，保存入数据对象accountBalamce 用于拦截器，
	 * accountBalamce对象乃是dirty对象，被修改后会被自动保存；
	 * 
	 * @param accountBalamce
	 *            dirty对象，被修改后会被自动保存
	 * @param id
	 *            其余参数参见org.hibernate.Interceptor#onFlushDirty
	 * @param newValues
	 * @param oldValues
	 * @param properties
	 * @param types
	 */
	public void setAccumulation(AccountBalance accountBalamce, Serializable id,
			Object[] newValues, Object[] oldValues, String[] properties,
			Type[] types) throws CallbackException;

}
